package com.bjgzy.courselive.mvp.model.entity;

import android.os.Parcel;
import android.os.Parcelable;

import com.eduhzy.ttw.commonsdk.entity.CommonData;
import com.eduhzy.ttw.commonsdk.entity.CourseCommentData;

import java.util.List;

/**
 * @author xubo
 * @date 2018/8/27 22:29
 */
public class CoursePlayData implements Parcelable {

    /**
     * isBuy : true
     * preImage :
     * commetData : {"result":true,"data":[{"resourceId":572,"star":4.5,"against":0,"title":"100以内的加减法总复习","userName":"18975875500","userId":382984,"content":"vggg","parentId":0,"realName":"张博","totalNum":2,"id":106,"support":0,"createDate":"2018-10-24"},{"resourceId":572,"star":4.5,"against":0,"title":"100以内的加减法总复习","userName":"18800002002","userId":358757,"content":"很有意思","parentId":0,"realName":"助教2","totalNum":2,"id":99,"support":0,"createDate":"2018-09-21"}],"count":12,"message":"查询成功！"}
     * color : 0
     * playInfo : 已播出
     * star : 4.5
     * price :
     * description : 通过分类、比较等方法，建立知识各部分之间的联系。分类整理各类计算，把握知识脉络，理清算理算法。
     * directStatus : 2
     * title : 100以内的加减法总复习
     * url : http://file.tangt.cn:8090/res00/resource/files/flv/e/e8a323b6-b41e-4cb9-9b1e-97a1851963a2/e8a323b6-b41e-4cb9-9b1e-97a1851963a2_720x480.mp4
     */

    private boolean isBuy;
    private String preImage;
    private CommonData<List<CourseCommentData>> commetData;
    private int color;
    private String playInfo;
    private double star;
    private String price;
    private String description;
    private int directStatus;
    private String title;
    private String url;

    public boolean isIsBuy() {
        return isBuy;
    }

    public void setBuy(boolean buy) {
        isBuy = buy;
    }

    public String getPreImage() {
        return preImage;
    }

    public void setPreImage(String preImage) {
        this.preImage = preImage;
    }

    public CommonData<List<CourseCommentData>> getCommetData() {
        return commetData;
    }

    public void setCommetData(CommonData<List<CourseCommentData>> commetData) {
        this.commetData = commetData;
    }

    public int getColor() {
        return color;
    }

    public void setColor(int color) {
        this.color = color;
    }

    public String getPlayInfo() {
        return playInfo;
    }

    public void setPlayInfo(String playInfo) {
        this.playInfo = playInfo;
    }

    public double getStar() {
        return star;
    }

    public void setStar(double star) {
        this.star = star;
    }

    public String getPrice() {
        return price;
    }

    public void setPrice(String price) {
        this.price = price;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public int getDirectStatus() {
        return directStatus;
    }

    public void setDirectStatus(int directStatus) {
        this.directStatus = directStatus;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByte(this.isBuy ? (byte) 1 : (byte) 0);
        dest.writeString(this.preImage);
        dest.writeSerializable(this.commetData);
        dest.writeInt(this.color);
        dest.writeString(this.playInfo);
        dest.writeDouble(this.star);
        dest.writeString(this.price);
        dest.writeString(this.description);
        dest.writeInt(this.directStatus);
        dest.writeString(this.title);
        dest.writeString(this.url);
    }

    public CoursePlayData() {
    }

    protected CoursePlayData(Parcel in) {
        this.isBuy = in.readByte() != 0;
        this.preImage = in.readString();
        this.commetData = (CommonData<List<CourseCommentData>>) in.readSerializable();
        this.color = in.readInt();
        this.playInfo = in.readString();
        this.star = in.readDouble();
        this.price = in.readString();
        this.description = in.readString();
        this.directStatus = in.readInt();
        this.title = in.readString();
        this.url = in.readString();
    }

    public static final Creator<CoursePlayData> CREATOR = new Creator<CoursePlayData>() {
        @Override
        public CoursePlayData createFromParcel(Parcel source) {
            return new CoursePlayData(source);
        }

        @Override
        public CoursePlayData[] newArray(int size) {
            return new CoursePlayData[size];
        }
    };
}
